#include<bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
const int N = 2e5 + 10;
#define INF 0x3f3f3f3f;
typedef long long int ll;
#define close(); std::ios::sync_with_stdio(false);cin.tie(0),cout.tie(0);
//----------------------------------------------------------------------------//
ll k;
void solve()
{
    cin >> k;

    ll l = 1, r = 1e5;
    while (l < r) 
    {
        ll mid = l + r + 1 >> 1; //二分第几个1,2,3,4,5
        ll sum = mid * mid;
        if (sum <= k) l = mid;
        else r = mid - 1;
    }
    k -= (r * r);
    //cout << "r is: " << r << '\n';
    if (k == 0)
    {
        cout << l << " " << 1 << '\n';
        return;
    }

    k--;//前面特判下
    if(k==0)
    {
        cout<<1<<" "<<l+1<<'\n';
        return;
    }

    int x = 1, y = l+1;
    for (int i = 1; i <= l; i++)
    {
        k--;
        x++;
        if (k == 0)
        {
            cout << x << ' ' << y << '\n';
            return;
        }
    }
    for (int i = 1; i < l; i++)
    {
        k--;
        y--;
        if (k == 0)
        {
            cout << x << ' ' << y << '\n';
            return;
        }
    }






}

int main()
{
    close();
    int T;
    cin >> T;
    while (T--) solve();
    return 0;
}
//1 3 5 7  1^2 2^2 3^2